# these are separated from tracdiscussion.api because of circular import (Multiproject.analytics)

from trac.core import Interface

class IForumChangeListener(Interface):
    """Extension point interface for components that require notification
    when new forums are created, modified or deleted."""

    def forum_created(context, forum):
        """Called when a forum is created. Argument `forum` is a dictionary with
        forum attributes."""

    def forum_changed(context, forum, old_forum):
        """Called when a forum is modified. `old_forum` is a dictionary
        containing the previous values of the forum attributes and `forum` is
        a dictionary with new values that has changed."""

    def forum_deleted(context, forum):
        """Called when a forum is deleted. Argument `forum` is a dictionary
        with values of attributes of just deleted forum."""

class ITopicChangeListener(Interface):
    """Extension point interface for components that require notification
    when new forum topics are created, modified or deleted."""

    def topic_created(context, topic):
        """Called when a topic is created. Argument `topic` is a dictionary with
        topic attributes."""

    def topic_changed(context, topic, old_topic):
        """Called when a topic is modified. `old_topic` is a dictionary
        containing the previous values of the topic attributes and `topic` is
        a dictionary with new values that has changed."""

    def topic_deleted(context, topic):
        """Called when a topic is deleted. Argument `topic` is a dictionary
        with values of attributes of just deleted topic."""

class IMessageChangeListener(Interface):
    """Extension point interface for components that require notification
    when new forum messages are created, modified or deleted."""

    def message_created(context, message):
        """Called when a message is created. Argument `message` is a dictionary
        with message attributes."""

    def message_changed(context, message, old_message):
        """Called when a message is modified. `old_message` is a dictionary
        containing the previous values of the message attributes and `message`
        is a dictionary with new values that has changed."""

    def message_deleted(context, message):
        """Called when a message is deleted. Argument `message` is a dictionary
        with values of attributes of just deleted message."""
